#include "Ground.h"
#include "Listtexture.h"
#include "Define.h"

Ground::Ground(void){}
Ground::~Ground(void){}
Ground::Ground (int left, int top, int _id)
{
	sprite = new Sprite(Listtexture::GROUND,Listtexture::GROUND_WIDTH,Listtexture::GROUND_HEIGHT,
		Listtexture::GROUND_COUNT,Listtexture::GROUND_SPRITEPERROW);
	id = _id;
	type = _GROUND;
	width = Listtexture::GROUND_WIDTH;
	height = Listtexture::GROUND_HEIGHT;
	UpdateRect(left,top,width,height);
	animateRate = Listtexture::GROUND_ANIMATE;
	lastAnimate = GetTickCount();
}
void Ground::update()
{
	DWORD now = GetTickCount();
	if(now - lastAnimate > animateRate)
	{
		sprite->Next();
		lastAnimate = now;
	}
}